local extension = Package("rfenghou_zhao")
extension.extensionName = "aaa_fenghou"

local U = require "packages/utility/utility"

Fk:loadTranslationTable{
  ["rfenghou_zhao"] = "绍赵",
}

local shile = General:new(extension, "rfenghou__shile", "zhao", 4)

local rfenghou__quqi = fk.CreateActiveSkill{
  name = "rfenghou__quqi",
  anim_type = "control",
  card_num = 0,
  min_target_num = 1,
  interaction = function()
    local all_choices = {"rfenghou__quqi_reset", "rfenghou__quqi_chain"}
    local choices = table.filter(all_choices, function(ch)
      return Self:getMark(ch.."-phase") == 0
    end)
    if #choices > 0 then
      return UI.ComboBox { choices = choices, all_choices = all_choices }
    end
  end,
  card_filter = Util.FalseFunc,
  target_filter = function(self, to_select, selected, selected_cards)
    local to = Fk:currentRoom():getPlayerById(to_select)
    if self.interaction.data == "rfenghou__quqi_reset" then
      return to.chained
    else
      return to:getMark("rfenghou__quqi_hprecord-turn") ~= 0 and not to.chained
    end
  end,
  can_use = function(self, player)
    return player:getMark("rfenghou__quqi_reset-phase") == 0 or player:getMark("rfenghou__quqi_chain-phase") == 0
  end,
  on_use = function(self, room, effect)
    local player = room:getPlayerById(effect.from)
    room:sortPlayersByAction(effect.tos)
    room:setPlayerMark(player, self.interaction.data.."-phase", 1)
    local recast = self.interaction.data == "rfenghou__quqi_reset"
    local tos = table.map(effect.tos, Util.Id2PlayerMapper)
    for _, to in ipairs(tos) do
      if not to.dead then
        to:setChainState(not recast)
      end
    end
    if not recast then return end
    room:delay(500)
    for _, to in ipairs(tos) do
      if not to.dead then
        room:doIndicate(player.id, {to.id})
        local name = "fire__slash"
        if table.contains(player:getTableMark("rfenghou__fenjie_tar"), to.id) and to:isWounded()
        and room:askForSkillInvoke(player, self.name, nil, "#rfenghou__quqi-change:"..to.id) then
          name = "peach"
        end
        U.askForUseVirtualCard(room, to, name, nil, self.name, nil, false, true, false, true)
      end
    end
  end,
}
local rfenghou__quqi_record = fk.CreateTriggerSkill{
  name = "#rfenghou__quqi_record",
  refresh_events = {fk.EventAcquireSkill, fk.HpChanged},
  frequency = Skill.Compulsory,
  can_refresh = function (self, event, target, player, data)
    if event == fk.HpChanged then
      return target == player and player:getMark("rfenghou__quqi_hprecord-turn") == 0
    else
      return target == player and data == self
    end
  end,
  on_refresh = function (self, event, target, player, data)
    local room = player.room
    if event == fk.HpChanged then
      room:setPlayerMark(player, "rfenghou__quqi_hprecord-turn", 1)
    else
      local tos = {}
      player.room.logic:getEventsOfScope(GameEvent.ChangeHp, 999, function(e)
        table.insertIfNeed(tos, e.data[1])
      end, Player.HistoryTurn)
      for _, p in ipairs(tos) do
        if not p.dead and p:getMark("rfenghou__quqi_hprecord-turn") == 0 then
          room:setPlayerMark(p, "rfenghou__quqi_hprecord-turn", 1)
        end
      end
    end
  end,
}
rfenghou__quqi:addRelatedSkill(rfenghou__quqi_record)
shile:addSkill(rfenghou__quqi)

local rfenghou__fenjie = fk.CreateTriggerSkill{
  name = "rfenghou__fenjie",
  frequency = Skill.Limited,
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self) and player.phase == Player.Start
    and player:usedSkillTimes(self.name, Player.HistoryGame) == 0
  end,
  on_cost = function (self, event, target, player, data)
    local _, dat = player.room:askForUseActiveSkill(player, "rfenghou__fenjie_choose", "#rfenghou__fenjie-invoke")
    if dat then
      player.room:sortPlayersByAction(dat.targets)
      self.cost_data = {tos = dat.targets}
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local tos = self.cost_data.tos
    room:setPlayerMark(player, "rfenghou__fenjie_tar", tos)
    for _, to in ipairs(table.map(tos, Util.Id2PlayerMapper)) do
      if not to.dead then
        to:drawCards(1, self.name)
        if not to.dead and not to:isNude() and not player.dead and player ~= to then
          local cards = to:getCardIds("he")
          if #cards > 2 then
            cards = room:askForCard(to, 2, 2, true, self.name, false, ".", "#rfenghou__fenjie-give:"..player.id)
          end
          room:obtainCard(player, cards, false, fk.ReasonGive, to.id, self.name)
        end
      end
    end
  end,
}
shile:addSkill(rfenghou__fenjie)

local rfenghou__fenjie_choose = fk.CreateActiveSkill{
  name = "rfenghou__fenjie_choose",
  card_num = 0,
  min_target_num = 1,
  card_filter = Util.FalseFunc,
  target_filter = function(self, to_select, selected)
    local to = Fk:currentRoom():getPlayerById(to_select)
    if to and not to:isRemoved() and (to.chained == Self.chained) then
      if #selected == 0 then
        return true
      else
        for _, id in ipairs(selected) do
          local p = Fk:currentRoom():getPlayerById(id)
          if to:getNextAlive() == p or p:getNextAlive() == to then
            return true
          end
        end
      end
    end
  end,
}
Fk:addSkill(rfenghou__fenjie_choose)

local rfenghou__renru = fk.CreateTriggerSkill{
  name = "rfenghou__renru",
  anim_type = "negative",
  events = {"fk.GeneralAppeared"},
  frequency = Skill.Compulsory,
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(self)
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local current = room.current
    if current and not current.dead then
      room:doIndicate(current.id, {player.id})
      if not player.dead and not player.chained then
        player:setChainState(true)
      end
      local targets = {}
      local to = player:getNextAlive()
      if to ~= player and not to.chained then
        table.insert(targets, to.id)
      end
      to = player:getLastAlive()
      if to ~= player and not to.chained then
        table.insertIfNeed(targets, to.id)
      end
      if #targets > 0 then
        if #targets > 1 then
          targets = room:askForChoosePlayers(current, targets, 1, 1, "#rfenghou__renru-choose:"..player.id, self.name, false, true)
        end
        room:doIndicate(current.id, targets)
        to = room:getPlayerById(targets[1])
        to:setChainState(true)
      end
    end
  end,
}
rfenghou__renru.isHiddenSkill = true
shile:addSkill(rfenghou__renru)

local rfenghou__xuanjiao = fk.CreateTriggerSkill{
  name = "rfenghou__xuanjiao$",
  frequency = Skill.Compulsory,
  events = {fk.CardUsing, fk.CardResponding},
  can_trigger = function(self, event, target, player, data)
    return target ~= player and player:hasSkill(self) and target.kingdom == "zhao" and player.phase ~= Player.NotActive
    and data.card.type == Card.TypeBasic
  end,
  on_cost = function (self, event, target, player, data)
    self.cost_data = {tos = {target.id}}
    return player.room:askForSkillInvoke(player, self.name, nil, "#rfenghou__xuanjiao-invoke:"..target.id)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:drawCards(1, self.name)
    if not target.dead then
      target:drawCards(1, self.name)
    end
  end,
}
shile:addSkill(rfenghou__xuanjiao)

Fk:loadTranslationTable{
  ["rfenghou__shile"] = "石勒",
  ["#rfenghou__shile"] = "朔戈胡襟",
  ["designer:rfenghou__shile"] = "紫乔",
  ["illustrator:rfenghou__shile"] = "啪啪三国",

  ["rfenghou__quqi"] = "屈起",
  [":rfenghou__quqi"] = "出牌阶段各限一次，你可以：1.重置任意名角色，然后令这些角色依次视为使用一张火【杀】（有距离限制）；2.横置任意名本回合体力值变化过的角色。 ",
  ["rfenghou__quqi_reset"] = "重置目标，令其使用火【杀】",
  ["rfenghou__quqi_chain"] = "横置本回合体力值变化的角色",
  ["#rfenghou__quqi-change"] = "屈起：%src 即将视为使用火【杀】，你可以令其改为使用【桃】",

  ["rfenghou__fenjie"] = "分界",
  [":rfenghou__fenjie"] = "限定技，准备阶段，你可以令任意名与你横置状态相同且座次连续的角色各摸一张牌并交给你两张牌，本局这些角色因“屈起”重置后，你可以改为令其视为使用【桃】。  ",
  ["#rfenghou__fenjie-invoke"] = "分界：你可以令任意名与你横置状态相同且座次连续的角色各摸一张牌并交给你两张牌",
  ["rfenghou__fenjie_choose"] = "分界",
  ["#rfenghou__fenjie-give"] = "分界：请交给 %src 两张牌",

  ["rfenghou__renru"] = "忍辱",
  [":rfenghou__renru"] = "隐匿，锁定技，你登场后，当前回合角色横置你与你一名邻家。",
  ["#rfenghou__renru-choose"] = "忍辱：请横置 %src 的一名邻家",

  ["rfenghou__xuanjiao"] = "宣教",
  [":rfenghou__xuanjiao"] = "主公技，其他赵势力角色于你回合内使用或打出基本牌时，你可以与其各摸一张牌。",
  ["#rfenghou__xuanjiao-invoke"] = "宣教：你可以与 %src 各摸一张牌。",
}

local shihu = General:new(extension, "rfenghou__shihu", "zhao", 4)

local rfenghou__sixian = fk.CreateTriggerSkill{
  name = "rfenghou__sixian",
  mute = true,
  frequency = Skill.Compulsory,
  events = {fk.DamageCaused},
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(self) and data.card and data.card.trueName == "slash" then
      local parentUse = player.room.logic:getCurrentEvent():findParent(GameEvent.UseCard)
      if not parentUse then return end
      parentUse = parentUse.data[1]
      return not (parentUse.extra_data and parentUse.extra_data.rfenghou__sixianCount and parentUse.extra_data.rfenghou__sixianCount > 1)
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local parentUse = room.logic:getCurrentEvent():findParent(GameEvent.UseCard)
    if not parentUse then return end
    parentUse = parentUse.data[1]
    parentUse.extra_data = parentUse.extra_data or {}
    parentUse.extra_data.rfenghou__sixianCount = (parentUse.extra_data.rfenghou__sixianCount or 0) + 1
    room:doIndicate(player.id, {data.to.id})
    if parentUse.extra_data.rfenghou__sixianCount == 1 then
      player:broadcastSkillInvoke(self.name, 1)
      room:notifySkillInvoked(player, self.name, "offensive", {data.to.id})
      if not data.to:isNude() then
        local card = room:askForCardChosen(player, data.to, "he", self.name)
        room:throwCard(card, self.name, data.to, player)
      end
    else
      player:broadcastSkillInvoke(self.name, 2)
      room:notifySkillInvoked(player, self.name, "negative", {data.to.id})
      if not data.to.dead then
        room:recover { num = 1, skillName = self.name, who = data.to, recoverBy = player }
      end
      return true
    end
  end,
}

local rfenghou__sixian_targetmod = fk.CreateTargetModSkill{
  name = "#rfenghou__sixian_targetmod",
  bypass_distances = function(self, player, skill, card)
    return player:hasSkill(rfenghou__sixian) and skill.trueName == "slash_skill"
  end,
  extra_target_func = function(self, player, skill)
    if skill.trueName == "slash_skill" and player:hasSkill(rfenghou__sixian) then
      return 999
    end
  end,
}
rfenghou__sixian:addRelatedSkill(rfenghou__sixian_targetmod)

shihu:addSkill(rfenghou__sixian)

local rfenghou__tuicuan = fk.CreateTriggerSkill{
  name = "rfenghou__tuicuan",
  anim_type = "control",
  events = {fk.TargetSpecified, fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(self) then
      if event == fk.TargetSpecified then
        return data.firstTarget
      else
        return player.phase == Player.Finish and table.find(player.room.alive_players, function (p)
          return p:getMark("@rfenghou__tuicuan-turn") ~= 0
        end)
      end
    end
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    if event == fk.TargetSpecified then
      local tos = table.filter(AimGroup:getAllTargets(data.tos), function (pid)
        return not room:getPlayerById(pid).dead
      end)
      if #tos == 1 then
        if room:askForSkillInvoke(player, self.name, nil, "#rfenghou__tuicuan-invoke:"..tos[1]) then
          self.cost_data = {tos = tos}
          return true
        end
      else
        tos = room:askForChoosePlayers(player, tos, 1, 1, "#rfenghou__tuicuan-choose", self.name, true)
        if #tos > 0 then
          self.cost_data = {tos = tos}
          return true
        end
      end
    else
      local maxNum = 0
      for _, p in ipairs(room.alive_players) do
        maxNum = math.max(maxNum, p:getMark("@rfenghou__tuicuan-turn"))
      end
      local tos = table.map(table.filter(room.alive_players, function (p)
        return p:getMark("@rfenghou__tuicuan-turn") == maxNum
      end), Util.IdMapper)
      if #tos == 0 then return false end
      if #tos > 1 then
        tos = room:askForChoosePlayers(player, tos, 1, 1, "#rfenghou__tuicuan-throw:::"..(maxNum+1), self.name, false)
      end
      self.cost_data = {tos = tos, num = maxNum+1}
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = room:getPlayerById(self.cost_data.tos[1])
    if event == fk.TargetSpecified then
      if player.phase ~= Player.NotActive then
        room:addPlayerMark(to, "@rfenghou__tuicuan-turn", 1)
      end
      to:drawCards(1, self.name)
    else
      if to:isNude() then return end
      local cards = to:getCardIds("he")
      local num = self.cost_data.num
      local suit = room:askForChoice(player, {"log_spade", "log_heart", "log_club", "log_diamond"}, self.name, "#rfenghou__tuicuan-suit")
      if #cards > num then
        cards = room:askForCardsChosen(player, to, num, num, "he", self.name)
      end
      room:throwCard(cards, self.name, to, player)
      if player.dead then return end
      cards = table.filter(cards, function (id) 
        return room:getCardArea(id) == Card.DiscardPile and Fk:getCardById(id):getSuitString(true) == suit
      end)
      if #cards > 0 then
        room:obtainCard(player, cards, true, fk.ReasonJustMove, player.id, self.name)
      end
    end
  end,
}
shihu:addSkill(rfenghou__tuicuan)

local rfenghou__taowan = fk.CreateTriggerSkill{
  name = "rfenghou__taowan$",
  anim_type = "offensive",
  frequency = Skill.Compulsory,
  events = {fk.BeforeCardUseEffect}, -- 时机需要比“推篡”晚一些
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(self) then
      local tos = table.map(table.filter(player.room.alive_players, function (p)
        return p.kingdom == "zhao" and p:getHandcardNum() == p:getMaxCards()
      end), Util.IdMapper)
      if #tos > 0 then
        self.cost_data = {tos = tos}
        return true
      end
    end
  end,
  on_use = function (self, event, target, player, data)
    data.disresponsiveList = data.disresponsiveList or {}
    table.insertTableIfNeed(data.disresponsiveList, self.cost_data.tos)
  end,
}

local rfenghou__taowan_maxcards = fk.CreateMaxCardsSkill{
  name = "#rfenghou__taowan_maxcards",
  correct_func = function(self, player)
    if player.kingdom == "zhao" then
      return #table.filter(Fk:currentRoom().alive_players, function (p)
        return p:hasSkill(rfenghou__taowan)
      end)
    end
  end,
}
rfenghou__taowan:addRelatedSkill(rfenghou__taowan_maxcards)

shihu:addSkill(rfenghou__taowan)

Fk:loadTranslationTable{
  ["rfenghou__shihu"] = "石虎",
  ["#rfenghou__shihu"] = "愠憎齑骨",
  ["designer:rfenghou__shihu"] = "yyuan",
  ["illustrator:rfenghou__shihu"] = "啪啪三国",
  ["cv:rfenghou__shihu"] = "Kazami",

  ["rfenghou__sixian"] = "肆燹",
  [":rfenghou__sixian"] = "锁定技，你使用【杀】无视距离和目标数限制，且首次造成伤害时，弃置目标一张牌；第二次造成伤害时，改为令目标回复1点体力。",

  ["rfenghou__tuicuan"] = "推篡",
  [":rfenghou__tuicuan"] = "你使用牌指定目标后，可以令一名目标摸一张牌；结束阶段，你选择一种花色，弃置本回合以此法摸牌最多的一名角色等量+1张牌，获得其中所选花色的牌。",
  ["@rfenghou__tuicuan-turn"] = "推篡",
  ["#rfenghou__tuicuan-choose"] = "推篡：你可以令一名目标角色摸一张牌！",
  ["#rfenghou__tuicuan-invoke"] = "推篡：你可以令 %src 摸一张牌！",
  ["#rfenghou__tuicuan-throw"] = "推篡：选择一名角色，弃置其 %arg 张牌",
  ["#rfenghou__tuicuan-suit"] = "推篡：选择你要获得的花色！",

  ["rfenghou__taowan"] = "梼腕",
  [":rfenghou__taowan"] = "​主公技，锁定技，赵势力角色的手牌上限+1；手牌数等于手牌上限的赵势力角色不能响应你使用的牌。",

  ["$rfenghou__sixian1"] = "成赵者，我也！黄口婢儿，不足复留种。",
  ["$rfenghou__sixian2"] = "斩首洗血、亵而后杀，和与牛羊煮食，美甚！",
  ["$rfenghou__tuicuan1"] = "君薨而世子立，臣安敢乱之？",
  ["$rfenghou__tuicuan2"] = "兽者，朕也!",
  ["$rfenghou__taowan1"] = "王室多难，四海业重，勉从推逼以副天人之望！",
  ["$rfenghou__taowan2"] = "皇帝之号非敢所闻，且可称大赵天王！",
  ["~rfenghou__shihu"] = "石者，朕也…葬我而去，吾将死矣。",
}

local ranmin = General:new(extension, "rfenghou__ranmin", "zhao", 5)
ranmin.subkingdom = "wei"
local lujie = fk.CreateTriggerSkill{
  name = "rfenghou__lujie",
  anim_type = "offensive",
  events = {fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and target.phase == Player.Start and target.hp <= player.hp and not target.dead
  end,
  on_cost = function(self, event, target, player, data)
    if player.room:askForSkillInvoke(player, self.name, nil, "#rfenghou__lujie-invoke::"..target.id) then
      self.cost_data = {tos = {target.id}}
      return true
    end
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local judge = {
      who = target,
      reason = "paranoid",
      pattern = ".|.|spade,heart,diamond",
    }
    room:judge(judge)
    if judge.card.suit ~= Card.Club and not target.dead then
      room:setPlayerMark(target, "@@rfenghou__lujie_paranoid-turn", 1)
    end
  end,
}
local lujie_delay = fk.CreateTriggerSkill{
  name = "#rfenghou__lujie_delay",
  mute = true,
  priority = 0.1,
  events = {fk.DrawNCards, fk.EventPhaseEnd},
  can_trigger = function(self, event, target, player, data)
    return target == player and player:getMark("@@rfenghou__lujie_paranoid-turn") > 0 and
      (event == fk.DrawNCards or player.phase == Player.Draw)
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    if event == fk.DrawNCards then
      data.n = data.n - 1
    else
      local room = player.room
      local targets = table.map(table.filter(room.alive_players, function(p)
        return p:distanceTo(target) == 1
      end), Util.IdMapper)
      room:sortPlayersByAction(targets)
      for _, pid in ipairs(targets) do
        local p = room:getPlayerById(pid)
        if not p.dead then
          p:drawCards(1, "rfenghou__lujie")
        end
      end
    end
  end,
}
local lujie_trigger = fk.CreateTriggerSkill{
  name = "#rfenghou__lujie_trigger",
  anim_type = "offensive",
  events = {fk.AfterCardsMove},
  can_trigger = function(self, event, target, player, data)
    if player:usedSkillTimes("rfenghou__lujie", Player.HistoryTurn) > 0 and not player.dead then
      local cards = {}
      for _, move in ipairs(data) do
        if move.to == player.id and move.skillName == "rfenghou__lujie" then
          for _, info in ipairs(move.moveInfo) do
            if table.contains(player:getCardIds("h"), info.cardId) then
              table.insertIfNeed(cards, info.cardId)
            end
          end
        end
      end
      if #cards > 0 then
        local targets = {}
        player.room.logic:getEventsOfScope(GameEvent.MoveCards, 1, function (e)
          for _, move in ipairs(e.data) do
            if move.to and move.to ~= player.id and move.moveReason == fk.ReasonDraw and
              not player.room:getPlayerById(move.to).dead then
              table.insertIfNeed(targets, move.to)
            end
          end
        end, Player.HistoryPhase)
        if #targets > 0 then
          self.cost_data = {tos = targets, cards = cards}
          return true
        end
      end
    end
  end,
  on_cost = function (self, event, target, player, data)
    local use = U.askForUseVirtualCard(player.room, player, "duel", self.cost_data.cards, "rfenghou__lujie",
      "#rfenghou__lujie-duel", true, false, false, false, {exclusive_targets = self.cost_data.tos}, true)
    if use then
      self.cost_data = use
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    player.room:useCard(self.cost_data)
  end,
}
local chouqu = fk.CreateTriggerSkill{
  name = "rfenghou__chouqu",
  frequency = Skill.Wake,
  events = {fk.Deathed},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self) and player:usedSkillTimes(self.name, Player.HistoryGame) == 0
  end,
  can_wake = function (self, event, target, player, data)
    return data.damage and data.damage.from and data.damage.from == player and
      data.damage.extra_data and data.damage.extra_data.rfenghou__chouqu
  end,

  refresh_events = {fk.BeforeHpChanged},
  can_refresh = function(self, event, target, player, data)
    return data.damageEvent and player == data.damageEvent.from and player:compareDistance(target, 2, "<")
  end,
  on_refresh = function(self, event, target, player, data)
    data.damageEvent.extra_data = data.damageEvent.extra_data or {}
    data.damageEvent.extra_data.rfenghou__chouqu = true
  end,
}
local chouqu_trigger = fk.CreateTriggerSkill{
  name = "#rfenghou__chouqu_trigger",
  anim_type = "special",
  frequency = Skill.Compulsory,
  events = {fk.EventPhaseChanging, fk.EventPhaseStart},
  can_trigger = function(self, event, target, player, data)
    if player:usedSkillTimes("rfenghou__chouqu", Player.HistoryGame) > 0 then
      if event == fk.EventPhaseChanging then
        return target == player and data.from > 1 and data.from < 8 and
          not table.contains(player:getTableMark("rfenghou__chouqu-turn"), data.from)
      elseif event == fk.EventPhaseStart then
        if target.phase == Player.Finish then
          local turn_event = player.room.logic:getCurrentEvent():findParent(GameEvent.Turn)
          if turn_event and not turn_event.data[1].dead then
            return #player.room.logic:getEventsOfScope(GameEvent.UseCard, 1, function(e)
              return e.data[1].from == player.id
            end, Player.HistoryTurn) > 0
          end
        end
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if event == fk.EventPhaseChanging then
      room:addTableMark(player, "rfenghou__chouqu-turn", data.from)
      player:gainAnExtraPhase(data.from, true)
    elseif event == fk.EventPhaseStart then
      local turn_event = room.logic:getCurrentEvent():findParent(GameEvent.Turn)
      if turn_event then
        local to = turn_event.data[1]
        room:doIndicate(player.id, {to.id})
        local skill = Fk.skills["benghuai"] or Fk.skills["efengqi__benghuai"]
        if skill then
          skill:use(event, to, to, data)
        end
      end
    end
  end,
}
lujie:addRelatedSkill(lujie_delay)
lujie:addRelatedSkill(lujie_trigger)
chouqu:addRelatedSkill(chouqu_trigger)
ranmin:addSkill(lujie)
ranmin:addSkill(chouqu)
ranmin:addRelatedSkill("efengqi__benghuai")
Fk:loadTranslationTable{
  ["rfenghou__ranmin"] = "冉闵",
  ["#rfenghou__ranmin"] = "映掩殄辰",
  ["designer:rfenghou__ranmin"] = "三秋",
  ["illustrator:rfenghou__ranmin"] = "佚名",

  ["rfenghou__lujie"] = "戮羯",
  [":rfenghou__lujie"] = "体力值不大于你的角色的准备阶段，你可以令其进行<a href='rfenghou__lujie_paranoid'>【草木皆兵】</a>判定；"..
  "你因此摸牌后，可以将之当【决斗】对另一名本阶段摸过牌的角色使用。",
  ["rfenghou__lujie_paranoid"] = "进行判定，若判定结果不为♣：摸牌阶段，少摸一张牌；摸牌阶段结束时，与其距离为1的角色各摸一张牌",
  ["rfenghou__chouqu"] = "雠驱",
  [":rfenghou__chouqu"] = "觉醒技，当你杀死距离为1的角色后，本局游戏你每个阶段额外执行一次；你使用过牌的回合的结束阶段，"..
  "当前回合角色需发动〖崩坏〗。",
  ["#rfenghou__lujie-invoke"] = "戮羯：是否令 %dest 进行【草木皆兵】判定？",
  ["#rfenghou__lujie_delay"] = "草木皆兵",
  ["@@rfenghou__lujie_paranoid-turn"] = "草木皆兵",
  ["#rfenghou__lujie_trigger"] = "戮羯",
  ["#rfenghou__lujie-duel"] = "戮羯：你可以将这些牌当【决斗】对其中一名角色使用！",
  ["#rfenghou__chouqu_trigger"] = "雠驱",
}

return extension
